from django.contrib import admin

# Register your models here.
from .models import AccountInfo



def get_all_field_names(model_class, exclude_fields):
    fields = [field.name for field in model_class._meta.fields]
    return [field for field in fields if field not in exclude_fields]


@admin.register(AccountInfo)
class AccountInfoAdmin(admin.ModelAdmin):
    exclude_fields = ['id', 'detail', 'remarks']
    list_display = get_all_field_names(AccountInfo, exclude_fields)  # 定义列表字段
    search_fields = list_display  # 搜索字段
    list_filter = list_display  # 过滤字段
    list_display_links = list_display  # 连接（点击后可进入当前行信息编辑）
    ordering = ['create_date']  # 排序字段
